#include "muyusound.h"
#include <QDebug>
#include <QMediaPlayer>
#include<synchapi.h>

muYuSound::muYuSound()
{

  // connect(startSound, SIGNAL(positionChang ed(qint64)), this, SLOT(positionChanged(qint64)));
    qDebug()<<"敲木鱼";
    QMediaPlayer* startSound = new QMediaPlayer;  //创建一个音乐播放器
    startSound=new QMediaPlayer;
    startSound->setMedia(QUrl::fromEncoded("qrc:/audio/muyu.mp3"));
    startSound->setVolume(100);
    startSound->play();
    qDebug()<<startSound->mediaStatus();

    connect(startSound, &QMediaPlayer::mediaStatusChanged, this, [=]{
        if(startSound->mediaStatus()==startSound->EndOfMedia)
        {
            startSound->deleteLater();
            delete (this);
        }



    });
    qDebug()<<"敲木鱼完成";



}

